﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace HiMapTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

           
            
        }

        private void ExitApp(object sender, EventArgs e)
        {
            this.Close();
        }

        private void MenuAddShapeFile_Click(object sender, EventArgs e)
        {
            HiMap.Carto.Map map = new HiMap.Carto.Map("zhj");
            this.mapControl1.Map = map;
            
            //HiMap.Driver.IDataFactory pDataFactory = new HiMap.Driver.Shape.ShapeDataFactory("\\Storage Card\\data\\dqxzbound\\");

            //HiMap.Carto.IFeatureClass pFeatureClass = (HiMap.Carto.IFeatureClass)pDataFactory.Open("bou_ln_clip.shp", false);

            //HiMap.Driver.IDataFactory pDataFactory = new HiMap.Driver.Shape.ShapeDataFactory("\\Storage Card\\data\\快速建模房屋面\\");

            //HiMap.Carto.IFeatureClass pFeatureClass = (HiMap.Carto.IFeatureClass)pDataFactory.Open("房屋面.shp", false);

            HiMap.Driver.IDataFactory pDataFactory = new HiMap.Driver.Shape.ShapeDataFactory("\\Storage Card\\数据\\太原\\");

            HiMap.Carto.IFeatureClass pFeatureClass = (HiMap.Carto.IFeatureClass)pDataFactory.Open("城市主干道L.shp", false);


            HiMap.Carto.IFeatureLayer pFeatureLayer = new HiMap.Carto.FeatureLayerClass(pFeatureClass);

            HiMap.Carto.Render.IFeatureLayerSimpleRender render = (HiMap.Carto.Render.IFeatureLayerSimpleRender)pFeatureLayer.Render;
            render.PolygonStyle.FillColor = Color.Red;
            render.PolygonStyle.OutLineColor = Color.Black;
            render.PolygonStyle.OutLineWidth = 2;

            render.PolylineStyle.SetLineSymbolColor(1, Color.Red);
            render.PolylineStyle.SetLineSymbolWidth(1, 2);


            HiMap.MapControls.Tools.ITool pTool = new HiMap.MapControls.Tools.ToolPan();
            pTool.OnCreate(this.mapControl1);
            this.mapControl1.CurTool = pTool;

            mapControl1.Map.AddLayer(pFeatureLayer);

            mapControl1.Map.Envelope = mapControl1.Map.FullEnvelope;

            mapControl1.MapRefresh();

            

        }
    }
}